home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_08_12
/
8n12092b
< prev
next >
Wrap
Text File
|
1990-10-07
|
411b
|
26 lines
Listing 3
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int comp(unsigned char **, unsigned char **);
unsigned char *list[] = { "cat", "car", "cab", "cap", "can" };
main()
{
int x;
qsort(list, 5, sizeof(unsigned char *), comp);
for (x = 0; x < 5; x++)
printf("%s\n", list[x]);
return 0;
}
int comp(unsigned char **a, unsigned char **b)
{
return strcmp(*a, *b);
}